package com.hgx.servlet.demo.test;/**
 * Created by liujun on 2018/5/28.
 */

/**
 * @author Administrator
 * @create 2018-05-28 13:58
 */
public class ThreadB extends Thread {

    private String fileName;


    public ThreadB(String name, String fileName) {
        super(name);
        this.fileName = fileName;
    }

    @Override
    public void run() {
        super.run();
        handler();
        Test.num ++ ;
        if(Test.num == Test.threadNum){
            System.out.println("******************** time: "+(System.currentTimeMillis() - Test.startTime));
        }
    }

    private void handler() {
        TaskB taskB = new TaskB();
        int len = taskB.readFile(fileName);
        System.out.println("name: " + super.getName() + " , len: " + len + " , ThreadId: " + Thread.currentThread().getId());
    }
}
